<template>
  <div class="container mb70">
    <p class="bread">
      <a href="#/index/cm-law-list" class="font-s-18" v-show="this.$route.query.type==='chief'">首席监控师-法律服务订单</a>
      <a href="#/index/law-order-manage" class="font-s-18" v-show="this.$route.query.type==='business'">业务管理部-法律服务订单</a>
      <a href="#/index/law-notice" class="font-s-18" v-show="this.$route.query.type==='lawNotice'">业务管理部-法律服务通知</a>
    </p>
    <div class="bg-c-fff box-border">
      <h3 class="tm-title">法律服务订单详情</h3>
      <step :stepData="stepData" :stepNum="stepNum" @stepRouter="stepRouter"></step>
    </div>
    <div class="bg-c-fff content">
      <p class="tc title">
        法律服务通知单
      </p>
      <ul class="fix box-border-top">
        <li class="flo-left tc">律师信息</li>
        <li class="flo-right fix">
          <p>{{lawyerName}}</p>
          <p>{{lawFirmName}}</p>
        </li>
      </ul>
      <ul class="fix box-border-top">
        <li class="flo-left tc">客户信息</li>
        <li class="flo-right fix">
          <p>{{customerName}}</p>
        </li>
      </ul>
      <ul class="fix box-border-top">
        <li class="flo-left tc">法律服务内容</li>
        <li class="flo-right fix">
          <textarea v-model="con" readonly="readonly"></textarea>
        </li>
      </ul>
      <ul class="fix box-border-top">
        <li class="flo-left tc">法律服务合同</li>
        <li class="flo-right fix">
          <a :href="contractUrl" target="_blank" class="contract">查看合同</a>
        </li>
      </ul>
      <ul class="fix box-border-top">
        <li class="flo-left tc">合同标价</li>
        <li class="flo-right fix">
          <input type="number" placeholder="请输入数字" class="input-css" v-model.number="money" readonly="readonly">
          <span>元</span>
          <span class="paid">{{status | paid}}</span>
        </li>
      </ul>
    </div>
  </div>
</template>
<script type="text/javascript">
import Step from '../components/Step'
export default {
  components: {
    Step
  },
  data() {
    return {
      stepNum: 0,
      stepData: [{
        name: '法律服务通知单'
      }, {
        name: '绘制流程图'
      }, {
        name: '法律服务监控'
      }, {
        name: '服务完成'
      }],
      con: '',
      money: '',
      contractUrl: '',
      id: '',
      stage: 0,
      status: 0,
      lawyerName: '',
      lawFirmName: '',
      customerName: ''
    }
  },
  mounted() {
    this.id = this.$route.query.id
    this.getData()
  },
  methods: {
    onBindClick() {
      this.$router.push('/lms-order-mapping?id=' + this.id)
    },
    getData() {
      this.$http.get('/legalService/read/detail', {
        params: {
          id: this.id
        }
      }).then(data => {
        if (data.data.httpCode === 200) {
          this.con = data.data.data.content
          this.money = data.data.data.contractPrice / 100
          this.contractUrl = data.data.data.contract
          this.stage = data.data.data.stage
          this.status = data.data.data.status
          this.lawyerName = data.data.data.lawyerName
          this.lawFirmName = data.data.data.lawFirmName
          this.customerName = data.data.data.customerName
        } else {
          this.$toasted.show(data.data.msg)
        }
      }).catch(err => {
        console.log(err)
        this.$toasted.show('网络出错')
      })
    },
    stepRouter(i, name) {
      this.$http.get('/legalService/read/detail', {
        params: {
          id: this.$route.query.id
        }
      }).then(data => {
        if (data.data.httpCode === 200) {
          if (i === 0 && data.data.data.status >= 2) {
            this.$router.push('/cm-law-notice?type=' + this.$route.query.type + '&id=' + this.$route.query.id)
          }
          if (i === 1 && data.data.data.status >= 2) {
            this.$router.push('/cm-law-drawing?type=' + this.$route.query.type + '&id=' + this.$route.query.id)
          }
          if (i === 2 && data.data.data.status >= 3) {
            this.$router.push('/cm-law-monitor?type=' + this.$route.query.type + '&id=' + this.$route.query.id)
          }
          if (i === 3 && data.data.data.status >= 4) {
            this.$router.push('/cm-law-complete?type=' + this.$route.query.type + '&id=' + this.$route.query.id)
          }
        } else {
          this.$toasted.show(data.data.msg)
        }
      }).catch(err => {
        console.log(err)
        this.$toasted.show('网络出错')
      })
    }
  },
  filters: {
    paid(v) {
      if (v >= 2) {
        return '已支付'
      } else {
        return '未支付'
      }
    }
  }
}

</script>
<style type="text/css" scoped>
.content {
  margin-top: 20px;
}

.box-border-top {
  border-top: 1px solid #ddd;
}

.content .title {
  line-height: 40px;
}

.content ul li.flo-left {
  border-right: 1px solid #dddddd;
  width: 396px;
}

.content ul li.flo-right {
  width: 800px;
  padding: 20px 0 20px 100px;
}

.content ul:nth-of-type(1) li.flo-left {
  line-height: 78px;
}

.content ul:nth-of-type(2) li.flo-left {
  line-height: 60px;
}

.content ul:nth-of-type(3) li.flo-left {
  line-height: 150px;
}

.content ul:nth-of-type(4) li.flo-left {
  line-height: 75px;
}

.content ul:nth-of-type(4) li.flo-left .blue-button {
  width: 100px;
  height: 40px;
}

.content ul:nth-of-type(5) li.flo-left {
  line-height: 80px;
}

.content ul:nth-of-type(3) textarea {
  width: 350px;
  height: 100px;
  padding: 10px 8px;
  border: 1px solid #ddd;
}

.content .button button {
  margin: 30px 0;
}

.contract {
  display: inline-block;
  margin-top: 8px;
  color: #01378c;
  text-decoration: underline;
}

</style>
